import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/view/Login/login'
import Work from '@/view/Work/work'
import Finish from '@/view/Finish/finish'
import Page from '@/view/Page/page'

Vue.use(Router)

//解决路由重复点击报错
const originalPush =Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}


export default new Router({
  routes: [
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/work',
      name: 'Work',
      component:Work,
      children:[
        {
          path: '/finish',
          name: 'Finish',
          component:Finish
        },
        {
          path: '/page',
          name: 'Page',
          component:Page
        }
      ]
    },
    //重定向到登录
    {path: '/', redirect: '/login'}
  ]
})

